import router from '../../router'
import store from '../index'

export default {
    state: {
        userInfo: {},
    },
    getters: {

    },
    mutations: {
        getUser(state, payload) {
            state.userInfo = payload
        },
        //退出清空用户信息
        clearuserInfo(state) {
            state.userInfo = {}
            state.user = {}
            store.commit('changeLogin')
                //退出登录跳首页
            router.push('/shouye')
        },
    },
    actions: {
        //获取用户信息
        async getUserInfo(context, payload) {
            context.commit('getUser', payload)
        }
    },
    namespaced: true,
}